<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
        xmlns:icecore="http://www.icefaces.org/icefaces/core"
       xmlns:ace="http://www.icefaces.org/icefaces/components"
       xmlns:ice="http://www.icesoft.com/icefaces/component"
       >      
    <h:head>
        <title><h:form><ice:outputText>Menu bearbeiten</ice:outputText></h:form></title>
    </h:head>
    <h:body>
        <ui:composition template="WEB-INF/templates/lecture.xhtml">
            
            <ui:define name="content">
                <ice:outputText value="Menu bearbeiten"/>
                <br />
                <br />
                <h:form>
                    <ice:commandButton value="Neue Kategorie"
                                       action="#{lectureBean.lecture.createCategory}" />
                </h:form>                    
                <ice:dataTable var="row"
                               value="#{editMenuBean.categorys}">
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="Menü Name" /></f:facet>
                        <ice:form>
                            <ice:inputText value="#{row.item.name}"
                                           partialSubmit="true"/>
                        </ice:form>     
                    </ice:column>
                    
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="View Rechte" /></f:facet>
                        <ice:form>
                            <ice:selectBooleanCheckbox value="#{row.adminViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.adminViewListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.coAdminViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.coadminViewListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.tutorViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.tutorViewListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.studentViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.studentViewListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.guestViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.guestViewListener}"/>
                        </ice:form>
                    </ice:column>
                    
                    <ice:column>
                        <h:form>
                            <ice:commandButton value="löschen"
                                               action="#{lectureBean.lecture.info.removeCategory(row)}" />
                        </h:form>
                    </ice:column>
                </ice:dataTable>
                <ice:dataTable value="#{editMenuBean.items}"
                               var="row">
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="Itemname"/></f:facet>
                        <ice:outputText value="#{row.item.name}" />
                    </ice:column>
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="Gruppe auswählen"/></f:facet>
                        <ice:form>
                            <ice:selectOneMenu partialSubmit="true"
                                               value="#{row.parent}"
                                             valueChangeListener="#{row.CategoryChanged}">
                                <f:converter converterId="categoryConverter" />
                                <f:selectItems value="#{editMenuBean.selectItems}" />
                            <ice:commandLink value="Ändern"
                                             action="editMenu.jsf" />
                            </ice:selectOneMenu>
                        </ice:form>
                    </ice:column>
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="View Rechte" /></f:facet>
                        <ice:form>
                            <ice:selectBooleanCheckbox value="#{row.adminViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.adminViewListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.coAdminViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.coadminViewListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.tutorViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.tutorViewListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.studentViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.studentViewListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.guestViewRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.guestViewListener}"/>
                        </ice:form>
                    </ice:column>
                    
                    <ice:column>
                        <f:facet name="header"><ice:outputText value="Edit Rechte" /></f:facet>
                        <ice:form>
                            <ice:selectBooleanCheckbox value="#{row.adminEditRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.adminEditListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.coAdminEditRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.coadminEditListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.tutorEditRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.tutorEditListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.studentEditRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.studentEditListener}"/>
                            <ice:selectBooleanCheckbox value="#{row.guestEditRights}" 
                                                       partialSubmit="true"
                                                       valueChangeListener="#{row.guestEditListener}"/>
                        </ice:form>
                    </ice:column>
                </ice:dataTable>
                               
                
            </ui:define>
        </ui:composition>
    </h:body>
</html>